<template>
	<view>
		<view>
			<image style="width: 400px; height: 200px;" :src="'http://localhost:9900/image/'+ setmeal.img"></image>
		</view>
		<view>
			<u-row customStyle="margin-bottom: 10px">
				<u-col span="6">
					<view class="demo-layout bg-purple-light">
						<span style="color:red;">$ {{setmeal.price}}元</span>
					</view>
				</u-col>
				<u-col span="6">
					<view class="demo-layout bg-purple-light">
						<u-button @tap="goYuyue" type="error">立即预约</u-button>
					</view>
				</u-col>
			</u-row>
		</view>
		<view v-for="(item,index) in setmeal.itemGroupList">
			{{item.name}}
			<view v-for="(data,i) in item.itemList">
				{{data.name}}
			</view>
		</view>
	</view>
</template>

 
 <!-- <template>
	<view>


		<view>
			<image :src="'http://127.0.0.1:9917/image/'+setmeal.img" style="width: 200px; height: 200px;"></image>
			<u-row customStyle="margin-bottom: 10px">
				<u-col span="6">
					<view class="demo-layout bg-purple-light">
						<span>${{setmeal.price}}</span>
					</view>
				</u-col>
				<u-col span="6">
					<view class="demo-layout bg-purple">
						<u-button type="erron" @tap="gosetmealorder(setmeal.id)">预约</u-button>
					</view>
				</u-col>
			</u-row>
		</view>
		
		<view v-for="(item,index) in setmeal.itemGroupList">
			{{item.name}}
			<view v-for="(data,i) in item.itemList">
				{{data.name}}
			</view>
		</view>


	</view>

</template> -->
<script>
	export default {
		data() {
			return {
				setmeal: {}
			};
		},
		onLoad(obj) {
			console.log("aa", obj.id)
			// 发送ajax 
			this.loadData(obj.id)
			console.log("bb", this.loadData)
		},
		methods: {
			loadData(id) {
				uni.request({
					url: "http://127.0.0.1:9900/api/setmeal/setmealMore?id=" + id,
					success: (res) => {
						console.log("12111", res)
						this.setmeal = res.data.data
						console.log("钱",res.data.data.price)
					}
				})
			},
			goYuyue(id) {
				alert("1233")
				if (localStorage.getItem("token") != null) {
					//自定义代码
					alert('key 存在')
					uni.navigateTo({
						url: "../setmealOrder/setmealOrder?id=" + id
					})
				} else {
					alert('key 不存在')
					uni.navigateTo({
						url: "../login/login"
					})
				}



			}
		}
	}
</script>

<style lang="scss">

</style>
